<?php

use Elite\Infrastructure\Helper\Logger;

return [
    'env' => $env['ENV'] ?? 'DEV',
    'server_name' => $env['SERVER_NAME'] ?? 'elite',
    'listen_ip' => $env['APP_URL'] ?? '127.0.0.1',
    'listen_port' => $env['LISTEN_PORT'] ?? '9501',
    'worker_num' => $env['WORKER_NUM'] ?? swoole_cpu_num(),
    'tasker_num' => $env['TASKER_NUM'] ?? swoole_cpu_num() * 2,
    'timer_delay' => $env['TIMER_DELAY'] ?? 60,
    'deamonize' => $env['DEAMONIZE'] ?? '',
    'app_url' => $env['APP_URL'] ?? '',
    'session_name' => 'ELSESSIONID',
    'session_lifetime' => 3600 * 24 * 2, //2天
    'secure_key' => $env['SECUER_KEY'] ?? 'elite-security',
    'log_dir' => $env['LOG_DIR'] ?? '/tmp',
    'log_level' => $env['LOG_LEVEL'] ?? Logger::INFO,
    'db_config' => [
        'master' => [
            'db_type' => $env['DB_TYPE'] ?? null,
            'db_host' => $env['DB_HOST'] ?? null,
            'db_port' => $env['DB_PORT'] ?? null,
            'db_name' => $env['DB_NAME'] ?? null,
            'usr' => $env['DB_USER'] ?? null,
            'pwd' => $env['DB_PASSWORD'] ?? null,
        ]
    ],
    'cache_config' => [
        [
            'type' => 'redis',
            'name' => $env['REDIS_NAME'] ?? null,
            'host' => $env['REDIS_HOST'] ?? null,
            'port' => $env['REDIS_PORT'] ?? null,
            'password' => $env['REDIS_PWD'] ?? null,
        ]
    ],
    'view_dir' =>  $env['VIEW_DIR'] ?? ROOT_DIR . DIRECTORY_SEPARATOR . 'page',
    'storage_dir' => $env['STORAGE_DIR'] ?? ROOT_DIR . DIRECTORY_SEPARATOR . 'storage',
];
